<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title>分配服务</title>
		<link rel="stylesheet" type="text/css" href="../layui/css/layui.css" />
	</head>
	<body style="padding: 10px;">
		<form class="layui-form" action="" lay-filter="formServeDistribution">
			<input type="hidden" name="seNo"  />
			<div class="layui-form-item">
				<label class="layui-form-label">服务类型</label>
				<div class="layui-input-block">
					<select name="seType" lay-verify="required" disabled="disabled">
						<option value="">请选择</option>
						<option value="0">咨询</option>
						<option value="1">投诉</option>
						<option value="2">建议</option>
					</select>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">服务详细内容</label>
				<div class="layui-input-block">
					<input disabled="disabled" type="text" name="seDetail" autocomplete="off" placeholder="请输入服务详细内容" class="layui-input">
				</div>
			</div>
			
			<div class="layui-form-item">
				<label class="layui-form-label">创建人</label>
				<div class="layui-input-block">
					<input disabled="disabled" type="text" name="seCreator" autocomplete="off" placeholder="请输入创建人" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">创建时间</label>
				<div class="layui-input-block">
					<input disabled="disabled" type="text" name="seCreatdate" id="test5" class="layui-input" placeholder="请输入创建时间">
				</div>
			</div>
			
			<div class="layui-form-item">
				<label class="layui-form-label">处理人</label>
				<div class="layui-input-block">
					<input type="text" name="seProcessor" autocomplete="off" placeholder="请输入处理人" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">服务状态</label>
				<div class="layui-input-block">
					<select name="seState" lay-verify="required" >
						<option value="">请选择</option>
						<option value="0">新创建</option>
						<option value="1">已分配</option>
						<option value="2">已处理</option>
						<option value="3">已归档</option>
					</select>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">分配时间</label>
				<div class="layui-input-block">
					<input type="text" name="seAssigindate" id="seAssigindate" class="layui-input" placeholder="请输入处理时间">
				</div>
			</div>
			
			<div class="layui-form-item">
				<div class="layui-input-block">
					<button type="submit" class="layui-btn" lay-submit="" lay-filter="submitServeDistribution">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
		</form>
		<script src="../layui/layui.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			layui.use(['form', 'jquery', 'laydate'], function() {
				var form = layui.form
				var laydate = layui.laydate
				var $ = layui.jquery
				//日期时间选择器
				laydate.render({
					elem: '#test5',
					type: 'datetime'
				});
				laydate.render({
					elem: '#seAssigindate',
					type: 'datetime'
				});
				//formServeProcess是form的lay-filter属性的值
				form.val('formServeDistribution', {
				"seNo": parent.row.seNo,
				"seType": parent.row.seType,
				"seDetail": parent.row.seDetail,
				"seState":parent.row.seState,
				"seCreator": parent.row.seCreator,
				"seCreatdate": parent.row.seCreatdate,
				"seAssigindate":parent.row.seAssigindate,
				"seProcessor": parent.row.seProcessor			
				});
				//监听提交
				//submitServeProcess是提交按钮的lay-filter属性的值
				form.on('submit(submitServeDistribution)', function(d) {
					if (form.verify()) {
						//data.field 表单的数据
						$.ajax({
							url: 'http://localhost:8080/serve/distributeServe',
							type: 'POST', //提交方式post,get....
							dataType: 'JSON', //后台返回数据格式
							data: d.field, //提交到后台的数据
							success: function(obj) {
								//执行ajax提交成功后处理代码
								//刷新窗口
							layer.msg(obj.msg) //来不及弹出信息
							parent.table.reload('tblService') //table需要是全局变量
							//当你在iframe页面关闭自身时
							var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
							parent.layer.close(index); //再执行关闭 
							}
						})
					}
					// layer.msg('提交成功')
					return false; //阻止form提交刷新
				});
			})
		</script>
	</body>
</html>
